home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr25 / memsz130.zip / ABOUT.C next >
C/C++ Source or Header  |  1993-03-14  |  4KB  |  129 lines

  1. /**************************************************************** ABOUT.C
  2.  *                                                                      *
  3.  *              Display "ABOUT" Dialog Box            *
  4.  *                                                                      *
  5.  ************************************************************************/
  6.  
  7. #define INCL_WIN
  8. #define INCL_GPI
  9. #include <os2.h>
  10.  
  11. #include <malloc.h>
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15.  
  16. #include "about.h"
  17. #include "object.h"
  18.  
  19.  
  20. /************************************************************************
  21.  *                         Function Prototypes                          *
  22.  ************************************************************************/
  23.  
  24. static METHODFUNCTION InitDlg ;
  25. static METHODFUNCTION Command ;
  26.  
  27. /************************************************************************
  28.  *                      Global Data Declarations                        *
  29.  ************************************************************************/
  30.  
  31. static METHOD Methods [] =
  32. {
  33.   { WM_INITDLG, InitDlg },
  34.   { WM_COMMAND, Command }
  35. } ;
  36.  
  37. /************************************************************************
  38.  *                                                                      *
  39.  *      "About" Dialog Box Procedure                                    *
  40.  *                                                                      *
  41.  ************************************************************************/
  42.  
  43. MRESULT EXPENTRY AboutProcessor 
  44.   ( HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2 )
  45. {
  46.   return
  47.   (
  48.     GeneralMessageProcessor
  49.     (
  50.       hwnd,
  51.       msg,
  52.       mp1,
  53.       mp2,
  54.       Methods,
  55.       sizeof(Methods)/sizeof(METHOD),
  56.       WinDefDlgProc,
  57.       NULL
  58.     )
  59.   ) ;
  60. }
  61.  
  62. /************************************************************************
  63.  *                                                                      *
  64.  *    Initialize Dialog                        *
  65.  *                                                                      *
  66.  ************************************************************************/
  67.  
  68. static MRESULT APIENTRY InitDlg
  69.   HWND hwnd, 
  70.   USHORT msg,
  71.   MPARAM mp1, 
  72.   MPARAM mp2, 
  73.   void *data 
  74. )
  75. {
  76.   ABOUT_PARMS *Parms = (ABOUT_PARMS*) ( PVOIDFROMMP ( mp2 ) ) ;
  77.  
  78.   WinSetWindowUShort ( hwnd, QWS_ID, Parms->id ) ;
  79.  
  80.   if ( Parms->hwndHelp )
  81.   {
  82.     WinAssociateHelpInstance ( Parms->hwndHelp, hwnd ) ;
  83.   }
  84.  
  85.   return ( MRFROMSHORT ( FALSE ) ) ;
  86.  
  87.   hwnd = hwnd ;  msg = msg ;  mp1 = mp1 ;  mp2 = mp2 ;  data = data ;
  88. }
  89.  
  90. /************************************************************************
  91.  *                                                                      *
  92.  *      Process commands received by Dialog.                            *
  93.  *                                                                      *
  94.  ************************************************************************/
  95.  
  96. static MRESULT APIENTRY Command
  97.   HWND hwnd, 
  98.   USHORT msg,
  99.   MPARAM mp1, 
  100.   MPARAM mp2, 
  101.   void *data 
  102. )
  103. {
  104.  /***********************************************************************
  105.   * Process action according to which control is reporting . . .        *
  106.   ***********************************************************************/
  107.  
  108.   switch ( SHORT1FROMMP ( mp1 ) )
  109.   {
  110.  
  111.    /*********************************************************************
  112.     * If it was the OK or CANCEL button, dismiss the dialog box.        *
  113.     *********************************************************************/
  114.  
  115.     case DID_OK:
  116.     case DID_CANCEL:
  117.     {
  118.       WinDismissDlg ( hwnd, TRUE ) ;
  119.       return ( 0 ) ;
  120.     }
  121.   }
  122.  
  123.   return ( 0 ) ;
  124.  
  125.   hwnd = hwnd ;  msg = msg ;  mp1 = mp1 ;  mp2 = mp2 ;  data = data ;
  126. }
  127.